package com.huluobo.a2301mdmdemo.demo

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Clear
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import coil.compose.AsyncImage
import com.huluobo.a2301mdmdemo.R

/**
 *  Created by LC on 2025/6/19.
 */

@Composable
fun MyText() {
    Column {
        //加载本地图片2种形式,第一个painterResource 加载的是Drawable文件夹中的图片
        Image(
            painter = painterResource(id = R.drawable.ic_launcher_background),
            contentDescription = "",
            //背景
            modifier = Modifier
                .background(Color.Black)
                //裁剪
                .clip(RoundedCornerShape(20.dp)),
        )
        //imageVector 加载系统自带图标
        Image(imageVector = Icons.Default.Clear, contentDescription = "")

        AsyncImage(
            model = "https://img1.baidu.com/it/u=4214113141,2036563917&fm=253&app=120&size=w931&n=0&f=JPEG&fmt=auto?sec=1729098000&t=0662d2b383091882ccdd43ad060de2a7",
            contentDescription = "",
            modifier = Modifier
                .size(300.dp)
                .background(Color.Black, CircleShape)
                //设置形状
                .clip(CircleShape).border(10.dp,Color.Red, CircleShape),
            //内容裁剪 Fit自适应 Crop 自适应裁剪,会填充满整个图片
        )
    }


    //纵向布局
//    Column(
//        Modifier.fillMaxHeight(),
//        horizontalAlignment = Alignment.CenterHorizontally,
//        verticalArrangement = Arrangement.spacedBy(10.dp)
//    ) {
//        Text(text = "LC")
//        Row {
//            Text(text = "LC")
//            Spacer(modifier = Modifier.width(10.dp))
//            Text(text = "LC")
//            Spacer(modifier = Modifier.width(50.dp))
//            Column {
//                Text(text = "LC")
//                Spacer(modifier = Modifier.height(50.dp))
//                Text(text = "LC")
//            }
//        }
//    }

    //横向布局
//    Row(
//        Modifier.fillMaxWidth(),
//        //Arrangement 常用的3个属性,spaceBy 设置间距 SpaceAround 分配剩余空间,并且真实分配,SpaceBeTween 分配剩余空间,并且首尾贴边框
//        horizontalArrangement = Arrangement.SpaceAround,
//        verticalAlignment = Alignment.CenterVertically
//    ) {
//        Text(text = "LC")
//        Text(text = "LC")
//        Text(text = "LC")
//        Text(text = "LC")
//        Text(text = "LC")
//        Text(text = "LC")
//        Text(text = "LC")
//    }

//    Text(
//        text = "LC123123123123123123123123123123123123123123", modifier = Modifier
//            .clickable {
//                Log.e("TagA", "点击了文本")
//            }
//            //占全屏的宽
//            .fillMaxWidth(),
//        //文本居中
//        textAlign = TextAlign.Center,
//        //颜色,2种形式,直接设置Color,
////        color = Color.Blue
//        //从color.xml中获取颜色
//        color = colorResource(id = R.color.purple_200),
//        //字体大小
//        fontSize = 22.sp,
//        //字重
//        fontWeight = FontWeight.Bold,
//        //最大行数
//        maxLines = 1,
//        //超出text范围之后
//        overflow = TextOverflow.Ellipsis,
//        //字符间距
//        letterSpacing = 10.sp
//    )
}